package com.example.materialcostsystembackend.service;

import com.example.materialcostsystembackend.model.OrderItemDetail;
import com.example.materialcostsystembackend.repository.OrderItemDetailRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;

@Service
public class OrderItemDetailService {
    @Autowired
    private OrderItemDetailRepository repository;

    public List<OrderItemDetail> getAllItems() {
        return repository.findAll();
    }


    public List<OrderItemDetail> getValidItems() {
        return repository.findByQuantityGreaterThan(BigDecimal.ZERO); // ✅ 用 BigDecimal.ZERO
    }
}
